package ycj.learn.springcloud.core.service;

import ycj.learn.springcloud.core.entities.Res;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserClientServiceFallbackFactory implements FallbackFactory<UserClientService> {
    @Override
    public UserClientService create(Throwable throwable) {
        return new UserClientService() {
            @Override
            public Res getOne(Long id) {

                return Res.error("Micro-service 'provider-consumeruser-hystrix' is not available!",500,throwable.getMessage());
            }
        };
    }
}
